<template>
  <div ref="radarMap" class="radar-echart" />
</template>

<script>
// 按需加载 - 导入需要的模块
const echarts = require('echarts/lib/echarts')
require('echarts/lib/chart/radar') // 引入雷达图
// 引入提示框和标题组件
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
export default {
  props: {
    data: {
      type: Array,
      default: () => []
    }
  },
  // 页面渲染完毕事件
  mounted() {
    // 得到图标实例
    const myChart = echarts.init(this.$refs.radarMap)
    myChart.setOption({
      title: {
        text: 'Web开发部效绩指数'
      },
      tooltip: {},
      radar: {
        name: {
          textStyle: {
            color: '#fff',
            backgroundColor: '#999',
            borderRadius: 3,
            padding: [3, 5]
          }
        },
        // 每个区域的最高值
        indicator: [
          { name: '工作效率', max: 100 },
          { name: '考勤', max: 100 },
          { name: '积极性', max: 100 },
          { name: '帮助同事', max: 100 },
          { name: '自主学习', max: 100 },
          { name: '正确率', max: 100 }
        ]
      },
      series: [{
        // name: '预算 vs 开销（Budget vs spending）',
        type: 'radar',
        // areaStyle: {normal: {}},
        data: this.data
      }]
    })
  }
}
</script>

<style>
.radar-echart {
    width: 600px;
    height: 400px;
}
</style>
